import * as puppeteer from 'puppeteer';


//该实例演示了如何自动画线
async function cadDrawLine()
{
    const browser = await puppeteer.launch({ headless: false });
    const page = await browser.newPage();
    await page.goto('http://192.168.1.101:8080');
    await page.waitFor(1000);

    await page.keyboard.down("L");
    await page.keyboard.down(" ");
    page.mouse.click(200, 200);
    page.mouse.click(250, 250);
    await page.keyboard.down("Escape");

    let pts= await page.evaluate(()=>{
    
        let app= window["app"];
        let line = app.m_Database.ModelSpace.objectCol[0];

        return  [line.StartPoint, line.EndPoint]
    })
    console.log(pts);
}

cadDrawLine();
